﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace CS544_Protocol_Client
{


    /**
    * Author: Kelly Page, Brian Driscoll
    * Date Created: 3/3/2011
    * Date Updated: 3/4/2011
    * 
    * Purpose: Handles and individual private message 
    * 
    **/


    class PrivateMessage
    {

        //private message room event
        public event EventHandler MessageUpdate;
        
        public string Username { get; private set; } //holds name of message sender
        public Dictionary<string,string> ChatLog { get; private set; } //holds chat private message log
        
        //Constructor
        public PrivateMessage(string sender)
        {
            this.Username = sender;
                      
        }
        

        //Adds a new message to the private message 
        public void addNewMessage(string userName, string newMessage)
        {

            string user = userName;
            string message = newMessage;
            this.ChatLog.Add(user,message);
            OnMessageUpdate();
        }





        private void OnMessageUpdate()
        {
            if (MessageUpdate != null)
                MessageUpdate(this, new EventArgs());
        }
        

    }
}
